<?php

$tariff_obj = new tariff_obj();
$record_obj = new record_obj();

if (isset($_REQUEST['action'])){
    switch ($_REQUEST['action']) {
        case 'add_tariff':
            $tariff = $_REQUEST['tariff'];
            $newId = $tariff_obj->addTariff($tariff);
            if (error_obj::isError($newId)){
                error_obj::setError($newId, UNEXCEPTED);
            } else {
                base_obj::redirect(ROOT . '?input=list_of_tariffs');
            }
            
            break;
    }
}

$tariff['types_of_record'] = $record_obj->getRecordTypes();

$GLOBALS['template_data'] = $tariff;
?>
